module RowlingsWizard
  module ActsAsRowlingsWizard
    extend ActiveSupport::Concern

    included do
    end
     
    module ClassMethods

      def acts_as_rowlings_wizard
        include RowlingsWizard::ActsAsRowlingsWizard::LocalInstanceMethods
      end
    end
 
    module LocalInstanceMethods
      def cast_spell(spell_name)
        spellbook.spell(spell_name)[:name]
      end

      def cast_random_spell
        spellbook.random_spell[:name]
      end

      def spellbook
        RowlingsWizard::Spellbook.new 
      end
    end
  end
end

ActiveRecord::Base.send(:include, RowlingsWizard::ActsAsRowlingsWizard)